# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=process-cpp
pkgver=3.0.2
pkgrel=0
pkgdesc="A simple convenience library for handling processes in C++11"
url="https://gitlab.com/ubports/core/lib-cpp/process-cpp"
arch="all"
license="LGPL-3.0-only"
depends_dev="properties-cpp-dev"
makedepends="$depends_dev cmake cmake-extras boost-dev gtest-dev samurai"
subpackages="$pkgname-dev"
source="https://gitlab.com/ubports/core/lib-cpp/process-cpp/-/archive/$pkgver/process-cpp-$pkgver.tar.gz
	no-execinfo.patch
	gcc12.patch
	"
options="!check" # Tests are randomly failing

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DPROCESS_CPP_ENABLE_DOC_GENERATION=OFF \
		-DPROCESS_CPP_WERROR=OFF \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E "linux_process_test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
62effb8c8be3db4443740be08ed1edbb497b5370c44d432638d68fe2d4bf24f552baf254503f44ab3433c4d72626b3c3dc6f5ecd2d1daf1941543365f81ef6ea  process-cpp-3.0.2.tar.gz
5f3d0fd01aac53a1c93acc7be9c53c012bfac1f7d1b6f600d5b3f8a4159deec89f3b2eee8707a0cd886d88fc9674bfa9adc291c33754f5dea515164ffa26d8c6  no-execinfo.patch
15f47d9e1c6333f7861e535804f9bcc530bba47e7717a635a5720da39cce0f198867b577e95f42b9f1014e82e43deceabfe137e80eb9c8984945b0c4646c4362  gcc12.patch
"
